﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FullThrustLogic.Helper
{
    public class XYHelper
    {
        public static double DistanceBetweenPoints(double x1, double y1, double x2, double y2)
        {
           return Math.Sqrt(Math.Pow((x2 - x1), 2.0) + Math.Pow((y2 - y1), 2.0));
        }

        public static LogicalPoint MovePointByDistanceByDirection(LogicalPoint logicalPoint, double distance, double angleDirection)
        {
            LogicalPoint returnLogicalPoint =  new LogicalPoint();
            returnLogicalPoint.X = logicalPoint.X + distance * Math.Cos(ConvertDegreesToRadians(angleDirection));
            returnLogicalPoint.Y = logicalPoint.Y + distance * Math.Sin(ConvertDegreesToRadians(angleDirection));
            return returnLogicalPoint;
        }

        private static double ConvertDegreesToRadians(double degrees)
        {
            return (Math.PI*degrees)/180.0;
        }
    }

    public class LogicalPoint
    {
        public LogicalPoint()
        {
        }

        public LogicalPoint(double x, double y)
        {
            X = x;
            Y = y;
        }
        public double X { get; set; }
        public double Y { get; set; }
    }
}
